<?php

require_once('config.php');
class phpsecureurl{

	var $var_name="aku"; 			
	var $decode_url;				
	function code_param_url(){
		$this->decode();
	}
	function encode($url){ 			
		if($GLOBALS['CONFIG']['secureurl'] == 'On')
		{
			$pos_debut=strpos($url,"?"); if(!$pos_debut){$sep="&";}
			
				$pos_long=strlen($url)-$pos_debut-1;
			
			$debut=substr($url,0,$pos_debut+1);
			$param=substr($url,$pos_debut+1,$pos_long);
			$code = base64_encode($param);
			return $debut.@$sep.$this->var_name."=".$code.@$fin;
		}
		else
		{
			return $url;
		}
	} 
	function decode (){ 
			$_SERVER['QUERY_STRING'] = '';
		
		if(isset($_REQUEST[$this->var_name])){ 
			$this->decode_url=base64_decode($_REQUEST[$this->var_name]); 
			parse_str($this->decode_url, $tbl); 
			foreach($tbl as $k=>$v){
				$_REQUEST[$k]=$v;
				$_GET[$k]=$v;
				$_SERVER['QUERY_STRING'] .= "$k=$v&";
				global $$k; 
				$$k=$v;
			}
		} 
	}

}


?>
